
#ifndef	_OSSCHEDULER_H_
#define	_OSSCHEDULER_H_

/* A scheduler wrapper that can check if a thread is blocked or not */

#include "OSThread.h"
#include "Worker.h"

#include <map>



using namespace std;

struct TT     //Thread Table
{
  string  status;        // 0 = disable
  int  accuMessQua ;   //the total number of messages “delivered” to the thread
  int  totMessQua ;    //Total number of messages “delivered” to the thread from the last quantum
  int  priority;

};


class OSScheduler
{


	private:
/*
		 Checks if the current thread is blocked or not.
		 * Returns true if it is blocked, and false otherwise
		bool checkThreadBlocked();

		 A notification that the current running thread has changed
		 * to the given thread.
		void notifyThreadChange(OSThread *newThread);*/
/*
	protected :
		 Will be used to verify if the thread is blocked or not
		int m_curThreadPhase;

		OSThread*	m_curThread;*/

	public:
		OSScheduler();

	//	OSScheduler(int quanta,threadsTable& tT ,map<string, Worker>* workers ,Mailer* mailer);

		virtual ~OSScheduler() { }

		/*init scheduler */
		virtual void init();

		/*next worker */
		virtual void nextWorker();

		/* checks if the system is stable */
		virtual bool isStable();


		/* prints summary :
		 *
		 * - number of context switches between threads.
		 * - sum of message quanta given to all worker threads from last initialization.
		 * - actual number of messages passed from last initialization.
		 * - the thread table .
		 */
		virtual void printSum();


};


#endif	//_OSSCHEDULER_H_

